<template>
  <view class="padding-10">
    <block v-for="(item,index) in infoList" :key="index">
      <view class="mainColor colorB border-10" style="border: 1px solid #fff;margin-bottom: 20rpx;">
        <view class="padding-10">
          昵称：
          <navigator :url="'/adminList/membership/detail?id='+item.memberId" style="color: aqua;">{{item.nickName}}
          </navigator>
        </view>
        <view class="padding-10">状态：{{memberType(item.status)}}</view>
        <view class="padding-10">头像：
          <view class="" v-if="item.avatarUrl === null">一</view>
          <image :src="item.avatarUrl" mode="" style="width: 100rpx;height: 100rpx;" v-else>
          </image>
        </view>
        <view class="padding-10">手机号：{{item.mobileNumber}}</view>
        <view class="padding-10">本金金额：{{item.principalBalance}}</view>
        <view class="padding-10">赠送金额：{{item.giftBalance}}</view>
        <view class="padding-10">备注：{{item.remark || '一'}}</view>
        <!-- <view class="padding-10">操作：
          <text style="margin-right: 20rpx;color: aqua;">修改</text>
          <text style="color: aqua;">删除</text>
        </view> -->
      </view>
    </block>
    <pagination :queryParams="queryParams" :total="total" @changeNum="changeNum" @changeSize="changeAdd" @reset="reset">
    </pagination>
  </view>
</template>

<script>
  import {
    listInfo
  } from "@/api/member/info";
  import {
    memberType
  } from '@/common/dict.js'
  export default {
    data() {
      return {
        total: 0,
        infoList: [],
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          merchantName: null,
          address: null,
          status: null,
          organizationCode: null,
          managerName: null,
          managerPhone: null,
          servicePhone: null,
          logoUrl: null,
        },
        memberTypeList: []
      };
    },
    methods: {
      // 组件传递的事件 0
      changeNum(e) {
        this.queryParams.pageNum = e
        this.getList()
      },
      changeAdd(e) {
        this.queryParams.pageSize = e
        this.getList()
      },
      reset() {
        this.queryParams.pageSize = 10
        this.queryParams.pageNum = 1
        this.getList();
      },
      getList() {
        this.loading = true;
        listInfo(this.queryParams).then((response) => {
          this.infoList = response.rows;
          console.log(this.infoList, 'this.infoList');
          this.total = response.total;
          this.loading = false;
        });
      },
      memberType(status) {
        memberType.then(res => this.memberTypeList = res)
        let arr = this.memberTypeList.find(item => item.dictValue == status)
        if (arr == null) {
          return '一'
        } else {
          return arr.dictLabel
        }
      }
    },
    onLoad() {
      this.getList()
    }
  }
</script>

<style lang="scss" scoped>

</style>